﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace JQuery.MVC
{
    public class QueryEngine
        : RazorViewEngine
    {
        public QueryEngine()
            : base()
        {
            ViewLocationFormats = new string[] { "~/views/{1}/{0}.cshtml", "~/views/shared/{0}.cshtml" };
            PartialViewLocationFormats = new string[] { "~/views/{1}/{0}.cshtml", "~/views/shared/{0}.cshtml" };
        }

        protected override IView CreatePartialView(ControllerContext context, string partialPath)
        {
            string path = Module.Manager.TheApp.MapFilePath(partialPath);

            return new QueryView(context, path, "", false, new string[] { });
        }

        protected override IView CreateView(ControllerContext context, string viewPath, string masterPath)
        {
            string path = Module.Manager.TheApp.MapFilePath(viewPath);

            return new QueryView(context, path, masterPath, false, new string[] { });
        }
    }
}
